package cn.wolfcode.luowowo.util;

import cn.wolfcode.luowowo.exception.LogicException;
import org.springframework.util.StringUtils;

public class AssertUtil {

    public static void hasLength(String text,String message){
        if(!StringUtils.hasLength(text)){
            throw new LogicException(message);
        }
    }

    /**
     * 判断v1v2的值是否一致
     * @param v1
     * @param v2
     * @param msg
     */
    public static void isEquals(String v1, String v2, String msg) {
        if(v1 == null || v2 == null){
            throw new LogicException("输入参数不能为空");
        }
        if(!v1.equals(v2)){
            throw new LogicException(msg);
        }
    }
}
